package com.itcodai.utils.thread;

import com.alibaba.fastjson.JSONObject;
import com.itcodai.dao.user.UserMapper;
import com.itcodai.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Callable;

/**
 * @author c-fanqj
 * @date 2023/5/17
 * @apiNote
 */
public class RunGroupCallable implements Callable<String> {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    private JSONObject object;

    private UserMapper userMapper;

    public RunGroupCallable() {
    }

    public RunGroupCallable(JSONObject object, UserMapper userMapper) {
        this.object = object;
        this.userMapper = userMapper;
    }

    @Override
    public String call() throws Exception {
        // 异步获取用户信息
        long id = object.getLong("id");
        User user = userMapper.getUser(id);
        return "用户信息-" + user;
    }
}
